<?php
/**
 * 增值服务model
 * author:ty
 * date:2018-2-2
*/
namespace App\Http\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class Extra extends Model
{
    /**
     * 室内设计
     * @mzj_interior_design 数据表
     * @param 需要记录的参数
     */
    protected static function interior($param)
    {
        $insert_data = [
            'userid' => $param['userid'],
            'design_name' => $param['design_name'],
            'design_type' => $param['design_type'],
            'design_space' => $param['design_space'],
            'design_amount' => $param['design_amount'],
            'design_require' => isset($param['design_require'])?$param['design_require']:null,
            'design_status' => 0,
            'created_at' => date('Y-m-d H:i:s',time()),
            'updated_at' => date('Y-m-d H:i:s',time())
        ];
        $res = DB::table('interior_design')->insertGetId($insert_data);
        return $res;
    }

    /**
     * 定制化
     * @mzj_customized
     * @param 需要记录的参数
    */
    protected static function customized($param)
    {
        $insert_data = [
            'userid' => $param['userid'],
            'customized_size' => $param['customized_size'],
            'customized_color' => $param['customized_color'],
            'customized_num' => $param['customized_num'],
            'customized_use' => $param['customized_use'],
            'customized_require' => isset($param['customized_require'])?$param['customized_require']:null,
            'customized_status' => 0,
            'created_at' => date('Y-m-d H:i:s',time()),
            'updated_at' => date('Y-m-d H:i:s',time())
        ];
        $res = DB::table('customized')->insertGetId($insert_data);
        return $res;
    }

    /**
     * 搬家服务
     * @param 需要记录的数据
    */
    protected static function moverservice($param)
    {
        $insert_data = [
            'userid' => $param['userid'],
            'move_name' => $param['move_name'],
            'move_phone' => $param['move_phone'],
            'move_email' => $param['move_email'],
            'move_addr' => $param['move_addr'],
            'move_require' => isset($param['move_require'])?$param['move_require']:null,
            'move_status' => 0,
            'created_at' => date('Y-m-d H:i:s',time()),
            'updated_at' => date('Y-m-d H:i:s',time())
        ];
        $res = DB::table('move_server')->insertGetId($insert_data);
        return $res;
    }

}
